const moveZeroes = function (nums) {
    let j = 0;
    for (let i = 0; i < nums.length; i++) {
        if (nums[i] !== 0) {
            nums[j] = nums[i];
            j++;
        }
    }
    // 遍历完了，把尾部的元素填充 0 即可
    nums.fill(0, j, nums.length);
    return nums
};

console.log(moveZeroes([2,0,1,4,5,0,3]))
